#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import os 
url='https://www.baidu.com/'
respose=requests.get(
             url=url,
             headers={
            'User-Agent':'Mozilla/5.0 (Windows NT 6.1;Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36'
             })
 
print(respose.encoding)#查看网页编码
respose.encoding='utf-8' #设置网页编码
print(respose.status_code)
# with open('a.html','w',encoding='utf-8') as f:
#      f.write(respose.text)

# f=open('a.txt','a+')
# f.write('1111111112')
# f.close()
# m=open('a.txt','r')
# new =m.read()
# print(new)
#print(respose.status_code)
s=respose.status_code
with open('a.html','w') as f:
	print(respose.status_code)
    #f.write(respose.encoding)
